package com.xbxkj.api.web.controller;


import org.springframework.web.bind.annotation.RequestMapping;
import com.xbxkj.commen.bean.layuiBean.ResultPage;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ResponseBody;
import com.xbxkj.commen.controller.model.ResultModel;
import com.xbxkj.commen.bean.AdminRole;
import java.util.HashMap;
import java.util.List;
    import com.xbxkj.commen.controller.helper.V;
    import com.xbxkj.commen.controller.helper.X;
    import com.xbxkj.commen.controller.model.ResultModel;

import java.util.Map;
    import com.xbxkj.commen.controller.BaseController;

/**
 * <p>
 * 角色表 前端控制器
 * </p>
 *
 * @author 张子艺
 * @since 2020-01-09
 */
@Controller
@RequestMapping("/admin/adminRole")
public class AdminRoleController extends BaseController{
     /** 主页面 */
    @RequestMapping("main.html")
    public String main(){
       return  "AdminRole/AdminRoleMain";
    }
    /** 添加页面跳转
     * @return 返回页面
     */
    @RequestMapping(value = "/addAdminRoleHtml")
    public String addAdminRoleHtml( ){
             return "AdminRole/AdminRoleAdd";
    }
    /** 编辑页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "/editAdminRoleHtml")
    public String editAdminRoleHtml(String id ,Model model ){
           model.addAttribute("adminRole",adminRoleService.selectAdminRoleByIdAdminRole(id));
             return "AdminRole/AdminRoleEdit";
    }

    /** 查看页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "/showAdminRoleHtml")
    public String showAdminRoleHtml(String id ,Model model ){
           model.addAttribute("adminRole",adminRoleService.selectAdminRoleByIdAdminRole(id));
             return "AdminRole/AdminRoleShow";
    }


    /** 分页查询AdminRole
     * @param page  页码
     * @param limit  查几条
     * @param adminRole  前端传进的参数
     * @return 返回统一分页信息
     */
    @RequestMapping(value = "/findAdminRoleByPage")
    @ResponseBody
    public ResultPage findAdminRoleByPage(Integer page, Integer limit,AdminRole adminRole){
             return adminRoleService.findAdminRoleByPage(page,limit,adminRole);
    }

    /** 添加AdminRole
     * @param adminRole  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "/addAdminRole")
    @ResponseBody
    public ResultModel<?> saveAdminRole(AdminRole adminRole  ){
             return adminRoleService.addAdminRole(adminRole);
    }

    /** 编辑AdminRole
     * @param adminRole  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "/editAdminRole")
    @ResponseBody
    public ResultModel<?> editAdminRole(AdminRole adminRole  ){
             return adminRoleService.editAdminRole(adminRole);
    }



    /** 删除一条AdminRole
     * @param id  前端传进的ID
     * @return 返回统一信息
     */
    @RequestMapping(value = "/delAdminRole")
    @ResponseBody
    public ResultModel<?> delAdminRole( String id  ){
             return adminRoleService.delAdminRole(id);
    }


}
